﻿@namespace SwashbucklerDiary.Rcl.Components
@inherits DialogComponentBase

<MultiDisplay OnUpdate="UpdateDisplay">
    <MobileContent>
        <MBottomSheetExtension MyValue="Visible"
                               MyValueChanged="InternalVisibleChanged"
                               ContentClass="rounded-t-lg">
            <ActivatorContent>
                @(ComputedActivatorContent(context))
            </ActivatorContent>
            <ChildContent>
                <MCard Class="rounded-t-lg py-2">
                    <MList>
                        <div @onclick="HandleOnCancel" class="dynamic-list-item-collection">
                            @foreach (var item in DynamicListItems)
                            {
                                @if (item.Show)
                                {
                                    <MListItem @key="item"
                                               OnClick="item.OnClick">
                                        <MListItemIcon>
                                            <MIcon>
                                                @(item.Icon)
                                            </MIcon>
                                        </MListItemIcon>
                                        <MListItemContent>
                                            @(I18n.T(item.Text))
                                        </MListItemContent>
                                    </MListItem>

                                    <MDivider></MDivider>
                                }
                            }
                        </div>
                        <MListItem>
                            <MButton Class="text-subtitle-1"
                                     Rounded="true"
                                     Block="true"
                                     Depressed="true"
                                     Large="true"
                                     OnClick="HandleOnCancel">
                                @(I18n.T("Share.Cancel"))
                            </MButton>
                        </MListItem>
                    </MList>
                </MCard>
            </ChildContent>
        </MBottomSheetExtension>
    </MobileContent>
    <DesktopContent>
        <MMenuExtension MyValue="Visible"
                        MyValueChanged="InternalVisibleChanged"
                        Rounded="@("lg")"
                        Bottom="true"
                        Right="true"
                        Transition="scroll-x-reverse-transition">
            <ActivatorContent>
                @(ComputedActivatorContent(context))
            </ActivatorContent>
            <ChildContent>
                <MList MinWidth="150">
                    @foreach (var item in DynamicListItems)
                    {
                        @if (item.Show)
                        {
                            <MListItem @key="item"
                                       Dense="true"
                                       OnClick="item.OnClick">
                                <MListItemIcon Class="mr-3">
                                    <MIcon Size="20">
                                        @(item.Icon)
                                    </MIcon>
                                </MListItemIcon>
                                <MListItemContent Class="text-subtitle-2">
                                    @(I18n.T(item.Text))
                                </MListItemContent>
                            </MListItem>
                        }
                    }
                </MList>
            </ChildContent>
        </MMenuExtension>
    </DesktopContent>
</MultiDisplay>